package com.hemaapp.yjnh.activity;

import xtom.frame.net.XtomNetTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.hemaapp.yjnh.bean.SysInitInfo;
import com.hemaapp.hm_FrameWork.HemaNetTask;
import com.hemaapp.hm_FrameWork.result.HemaBaseResult;
import com.hemaapp.yjnh.BaseActivity;
import com.hemaapp.yjnh.BaseApplication;
import com.hemaapp.yjnh.R;

/**
 * 分享页面
 */
public class ShareActivity extends BaseActivity {
	private TextView titleText;
	private ImageButton titleLeft;
	private Button titleRight;

	private WebView webView;

	private String idExra;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_share);
		super.onCreate(savedInstanceState);
	}

	@Override
	protected void findView() {
		titleText = (TextView) findViewById(R.id.title_text);
		titleLeft = (ImageButton) findViewById(R.id.title_left_btn);
		titleRight = (Button) findViewById(R.id.title_right_btn);

		webView = (WebView) findViewById(R.id.webview);

		SysInitInfo initInfo = BaseApplication.getInstance().getSysInitInfo();
		String sys_plugins = initInfo.getSys_plugins();
		String path = sys_plugins + "share/webview.php?id=" + idExra;
		webView.loadUrl(path);
	}

	@Override
	protected boolean onKeyBack() {
		if (webView.canGoBack()) {
			webView.goBack();
			return true;
		}
		return super.onKeyBack();

	}

	@Override
	protected void getExras() {
		idExra = mIntent.getStringExtra("id");
	}

	@Override
	protected void setListener() {
		titleText.setText("分享");
		titleLeft.setVisibility(View.VISIBLE);
		titleLeft.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		titleRight.setVisibility(View.GONE);
	}

	@Override
	protected void callBeforeDataBack(XtomNetTask netTask) {
	}

	@Override
	protected void callAfterDataBack(XtomNetTask netTask) {
	}

	@Override
	protected void callBeforeDataBack(HemaNetTask netTask) {
	}

	@Override
	protected void callAfterDataBack(HemaNetTask netTask) {
	}

	@Override
	protected void callBackForServerSuccess(HemaNetTask netTask,
			HemaBaseResult baseResult) {
	}

	@Override
	protected void callBackForGetDataFailed(HemaNetTask netTask, int failedType) {
	}

	@Override
	protected void callBackForServerFailed(HemaNetTask netTask,
			HemaBaseResult baseResult) {
		// TODO Auto-generated method stub
		
	}

}
